var xtSourcesWinAdd;
var xtSourcesFormAdd;
function addXtSources(){
	initXtSourcesFormAdd();
	xtSourcesWinAdd = Ext.create('Ext.Window',{
		layout:'fit',
		width:800,
		height:400,
		maximizable:true,
		minimizable:true,
		animateTarget:document.body,
		plain:true,
		modal:true,
		title:'添加信息',
		listeners:{
			minimize:function(win,opts){
				if(!win.collapse()){
					win.collapse();
				}else{
					win.expand();
				}
			}
		},
		items:xtSourcesFormAdd,
		buttons:[{
			text:'保存',
			itemId:'save',
			handler:function(button){
				submitForm(xtSourcesFormAdd,'../xtSourcesController/addXtSources',grid,xtSourcesWinAdd,false,true);
			}
		},{
			text:'关闭',
			itemId:'close',
			handler:function(button){
				button.up('window').close();
			}
		}]
	});
	xtSourcesWinAdd.show();
}
function initXtSourcesFormAdd(){
	xtSourcesFormAdd = Ext.create('Ext.FormPanel',{
		xtype:'form',
		waitMsgTarget:true,
		defaultType:'textfield',
		autoScroll:true,
		fieldDefaults:{
			labelWidth:70,
			labelAlign:'left',
			flex:1,
			margin:'2 5 4 5'
		},
		/**新方法使用开始**/  
        scrollable:true,  
        scrollable:'x',
        scrollable:'y',
        /**新方法使用结束**/ 
		items:[
		{
			fieldLabel:'标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题',
			xtype:'textfield',
			name:'xt_sources_title',
			maxLength:100,
			anchor:'100%'
		},
		{
			fieldLabel:'描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述',
			xtype:'textareafield',
			name:'xt_sources_remark',
			maxLength:800,
			anchor:'100%'
		},
		{
			fieldLabel:'状&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;态',
			xtype:'combo',
			labelWidth:70,
			emptyText:'请选择',
			store:XT_SOURCES_STATUS_COMBO,
			mode:'local',
			triggerAction:'all',
			editable:false,
			hiddenName:'xt_sources_status',
			valueField:'value',
			displayField:'text',
			name:'xt_sources_status',
			anchor:'40%'
		},
		{
			fieldLabel:'类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型',
			xtype:'combo',
			labelWidth:70,
			emptyText:'请选择',
			store:XT_SOURCES_TYPE_COMBO,
			mode:'local',
			triggerAction:'all',
			editable:false,
			hiddenName:'xt_sources_type',
			valueField:'value',
			displayField:'text',
			name:'xt_sources_type',
			anchor:'40%'
		},
		{
			fieldLabel:'附件编号',
			xtype:'textfield',
			hidden:true,
			allowBlank:false,
			name:'xt_attachment_id',
			id:'xt_attachment_id',
			maxLength:32,
			anchor:'100%'
		},
		{
			title:'静态资源附件',
			xtype:'fieldset',
			items:{
				xtype:'box', 
				id:'xt_attachment_id_pic',
				margin:'2 5 4 70',
				autoEl:{  
			        tag:'img',			    
			        onclick:"optupload('xt_attachment_id','xt_attachment_id_pic',1)",    
			        src:bsdefimg
			    } 
			}
		}
		]
	});
}
